#include "tree.h"
#include <iostream>

int maxDepth = 0;

/**
  decStr: a decorate string with spaces
*/
void ItemOrg::print(double usage, string decStr, int depth)
{
    if( maxDepth < depth ) maxDepth = depth;

    cout<<decStr<<itemId()<<"_"<<orgId()<<" ["<<usage<<"] "<< (isCoProduct()?" [Co/By] ":" ") << (isTree()?"------":"") <<endl;

    if( isTree() )
    {
        for( size_t i = 0; i < mComponents.size(); i++ )
        {
            ItemOrg* comp = mComponents[i];
            double usage = mUsages[i];
            comp->print(usage, decStr + "        ", depth+1);
        }
    }
}
